<table class="table table-striped">
  <thead>
    <tr>
      <th>ID</th>
      <th>Name</th>
      <th>Strategy</th>
      <th>TrafficRate(%)</th>
      <th>Status</th>
      <th>API</th>
      <th>ClusterID</th>
      <th>操作</th>
    </tr>
  </thead>
  <tbody>
    <% @routings.each do |routing| %>
      <tr>
        <td><%= link_to routing.id, routing_path(routing.id), class: 'btn btn-info btn-xs' %></td>
        <td><%= routing.name %></td>
        <td><%=t routing.strategy_name, scope: 'enum.strategy' %></td>
        <td><%= routing.traffic_rate %></td>
        <td><%= routing.status_name %></td>
        <td><%= link_to routing.api, api_path(routing.api), class: 'btn btn-info btn-xs' %></td>
        <td><%= link_to routing.cluster_id, cluster_path(routing.cluster_id), class: 'btn btn-info btn-xs' %></td>
        <td>
          <%= link_to '编辑', edit_routing_path(routing.id), class: 'btn btn-warning btn-xs' %>
          <%= link_to '删除', routing_path(routing.id), method: :delete, class: 'btn btn-danger btn-xs', data: {confirm: "你确认删除吗？"} %>
        </td>
      </tr>
    <% end %>
  </tbody>
</table>

<%= link_to '新建路由', new_routing_path, class: 'btn btn-primary' %>

<% last_id = @routings.max{|x| x.id}.try(:id).to_i %>
<%= link_to '第一页', routings_path(after: 0, per_page: @per_page || 10), class: 'btn btn-primary' %>
<%= link_to_if last_id, '下一页', routings_path(after: last_id, per_page: @per_page || 10), class: 'btn btn-primary' %>
